package com.zhaojun.cloud.service.api;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collection;
import java.util.Set;

/**
 * wwj
 * 2018/12/5  10:34
 */
@FeignClient(name = "zhaojun-service-redis")
public interface RedisService {

    @GetMapping("/get/{key}")
    String get(@PathVariable(value = "key") String key);

    @GetMapping("/set")
    Boolean set(@RequestParam("key") String key,@RequestParam("value") String value);

    @GetMapping("/hget")
    String hget(@RequestParam("hkey") String hkey,@RequestParam("key") String key);

    @GetMapping("/hset")
    Boolean hset(@RequestParam("hkey") String hkey,@RequestParam("key") String key,@RequestParam("value") String value);

    @GetMapping("/hsize")
    int hsize(@RequestParam("hkey") String hkey) ;

    @GetMapping("/hkeys")
    Set hkeys(@RequestParam("hkey") String hkey);

    @GetMapping("/hvalues")
    Collection hvalues(@RequestParam("hkey") String hkey);

    @GetMapping("/incr/{key}")
    Long incr(@PathVariable("key") String key);

    @GetMapping("/decr/{key}")
    Long decr(@PathVariable("key") String key);

    @GetMapping("/expire")
    Boolean expire(@RequestParam("key") String key,@RequestParam("second") Long second);

    @GetMapping("/ttl/{key}")
    Long ttl(@PathVariable("key") String key);

    @GetMapping("/del/{key}")
    Boolean del(@PathVariable(value = "key") String key);

    @GetMapping("/hdel")
    Long hdel(@RequestParam("hkey") String hkey,@RequestParam("key") String key);
}
